/*
 * BPerSslMbedssl.h
 *
 *  Created on: 2022年7月25日
 *      Author: bPer
 */

#ifndef INCLUDE_BPERSSL_BPERMBEDTLS_H_
#define INCLUDE_BPERSSL_BPERMBEDTLS_H_
#include <bperutil/BPerType.h>
#include <stdint.h>
#if !BPer_Enable_Openssl
#if BPer_Enable_Dtls
#include <mbedtls/version.h>
#include <mbedtls/ssl.h>

#define BPer_SHA256_Length 32
#if (MBEDTLS_VERSION_NUMBER>0x03000000)
#define BPer_Mbedtls_3 1 //0:mbedtls2.0 1:mbedtls3.0
#else
#define BPer_Mbedtls_3 0 //0:mbedtls2.0 1:mbedtls3.0
#endif

typedef struct{
    char fingerprint[128];
    BPerBool ecdsa_mode;
    mbedtls_x509_crt *dtls_cert;
    mbedtls_pk_context *dtls_pkey;
}BPerCertificate;

#ifdef __cplusplus
extern "C"{
#endif
int32_t bPer_hmac_encode(const char* algo, const char* key, const int32_t key_length,
       const char* input, const int32_t input_length, char* output, uint32_t* output_length);

int32_t bPer_ssl_md5(const uint8_t* keystr,size_t keystrLen,uint8_t* str);

int32_t bPer_create_certificate(BPerCertificate* cer);
void bPer_destroy_certificate(BPerCertificate* cer);
void g_bPer_create_srtp();
void g_bPer_destroy_srtp();
#ifdef __cplusplus
}
#endif

#endif
#endif
#endif /* INCLUDE_BPERSSL_BPERMBEDTLS_H_ */
